//
//  FirstMyCell.m
//  TakeHer
//
//  Created by Jupiter on 15/6/11.
//  Copyright (c) 2015年 蓝鸥科技. All rights reserved.
//

#import "FirstMyCell.h"

@implementation FirstMyCell
-(void)dealloc
{
    [_myImageView release];
    [_myLabel release];
    [super dealloc];
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        self.myImageView = [[UIImageView alloc]init];
        //self.myImageView.backgroundColor = [UIColor cyanColor];
        [self.contentView addSubview:_myImageView];
        [_myImageView release];
        
        
        self.myLabel = [[UILabel alloc]init];
       self.myLabel.textColor = [UIColor whiteColor];
        self.myLabel.font = [UIFont systemFontOfSize:20];
        self.myLabel.textAlignment = NSTextAlignmentCenter;
        [self.contentView addSubview:_myLabel];
        [self.myLabel setShadowColor:[UIColor blackColor]];
        [self.myLabel setShadowOffset:CGSizeMake(0, 1)];
        [_myLabel release];
        
    }
    return self;
}

-(void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    //collectionViewCell 会在每次显示的时候调用这个方法
    
    //这个方法会先于数据调用
    
    //UICollectionViewLayoutAttributes类的对象 作用: 负责保存cell的布局信息(frame, size, center, alpha, ...)
    
    //每当cell要显示的时候,都去读取自己的信息
    
    CGFloat width = layoutAttributes.frame.size.width ;
    CGFloat height = layoutAttributes.frame.size.height / 4;
    
    self.myImageView.frame = CGRectMake(0, 0, width, height * 3);
    
    self.myLabel.frame = CGRectMake(0, height * 2 , width, height );
    
}




@end
